#pragma once

#include <SFML\Network.hpp>
//#include <string>
#include <iostream>

namespace U2L
{
	class AsyncConnector : private sf::Thread
	{
	public:
		AsyncConnector(void);
		~AsyncConnector(void);

		bool IsConnecting(void) const;
		bool IsDone(void) const;
		void Connect(sf::SocketTCP* _socket, unsigned short _port, sf::IPAddress _ip, float _timeout = 10.0f);
	private:
		virtual void Run(void);

		bool m_connecting;
		bool m_done;

		sf::SocketTCP* m_socket;
		unsigned short m_port;
		sf::IPAddress m_ip;
		float m_timeout;
	};
}